package com.allwees.bs.module.lms.track;

import com.allwees.bs.module.lms.entity.LogisticsWaybill;
import lombok.Data;

import java.util.Objects;

/**
 * @Author Daniel
 * @Version 1.0.0
 * @Description
 * @CreateTime 2020/9/19 17:02
 */
@Data
public class Tracking51Obj {
    private String tracking_number;
    private String carrier_code;

    public Tracking51Obj(){}
    public Tracking51Obj(String trackNum, String cc){
        this.tracking_number = trackNum;
        this.carrier_code = cc;
    }
    public Tracking51Obj(LogisticsWaybill item){
        this.tracking_number = item.getExpressCode();
        this.carrier_code = item.getCarrierCode();
    }

    @Override
    public int hashCode(){
        return Objects.hashCode(tracking_number) + Objects.hashCode(carrier_code);
    }

    @Override
    public boolean equals(Object obj){
        if(obj == null){
            return false;
        }

        if(!(obj instanceof Tracking51Obj)){
            return false;
        }
        if (this == obj) {
            return true;
        }

        Tracking51Obj to = (Tracking51Obj) obj;
        return Objects.equals(this.tracking_number,to.tracking_number) && Objects.equals(this.carrier_code,to.carrier_code);
    }
}
